﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 自制数学工具
{
    public class Vector
    {
        private double x; private double y; private double z;

        public Vector() { }
        public Vector(Point start,Point end) {
            x = end.X - start.X;
            y = end.Y - start.Y;
            z = end.Z - start.Z;
        }
        public Vector(double x, double y, double z)
        {
            X = x;
            Y = y;
            Z = z;
        }

        public double X { get { return x; } set {  x = value; } }
        public double Y { get { return y; } set { y = value; } }
        public double Z { get { return z; } set { z = value; } }

        public double Length()
        {
            return Math.Sqrt(x * x + y * y + z * z);
        }

        public Vector Add(Vector v)
        {
            return new Vector(X + v.X, Y + v.Y, Z + v.Z);
        }
        public Vector Substract(Vector v)
        {
            return new Vector(X - v.X, Y - v.Y, Z - v.Z);
        }
        public Vector Multiply(double k)
        {
            return new Vector(X * k, Y * k, Z * k);
        }
    }
}
